<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2021/6/16
  Time: 12:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>testTools</title>
    <script type="text/javascript" src="<c:url value="/js/ajaxUtils.js" />"></script>
    <script type="text/javascript">
        window.onload = function () {
            var btn = document.getElementById("btn");
            btn.onclick = function () {
                ajax(
                    {
                        url:"<c:url value="/jsonServlet"/>",
                        type:"json",
                        callback:function (data) {
                            document.getElementById("h1").innerHTML =
                                data.name+","+data.age;
                        }
                    }
                );
            };
        };
    </script>
</head>
<body>
<h3>ajax tools using</h3>
<button id="btn">click here to show jsonData by ajaxUtils</button>
<h1 id="h1"></h1>
</body>
</html>
